package cn.huhst.cas.weisiqian.service;

import java.util.ArrayList;

import cn.huhst.cas.weisiqian.dao.NewsDao;
import cn.huhst.cas.weisiqian.pojo.COMMENT_TYPE;
import cn.huhst.cas.weisiqian.pojo.Comment;
import cn.huhst.cas.weisiqian.pojo.News;

public class NewsService {

	private NewsDao newsdao = null;

	public NewsService() {
		newsdao = new NewsDao();
	}

	public boolean addNews(News news) {
		boolean result;
		result = newsdao.addPostType(news);
		return result;
	}

	public int getNewsCount() {
		return newsdao.getNewsCount();
	}

	public ArrayList<News> getNews(int pageIndex, int pageSize) {
		int recorderIndex = (pageIndex - 1) * pageSize;
		return newsdao.getNews(recorderIndex, pageSize);
	}

	public boolean deleteNews(String newsid) {
		return newsdao.deleteNews(newsid);
	}

	public News getNewsByNewsID(String newsid) {
		return newsdao.getNewsByNewsID(newsid);
	}

	public ArrayList<Comment> getComment(int newsid, COMMENT_TYPE newsComment) {
		return newsdao.getComment(newsid,newsComment);
	}

}
